<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件监听</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        div{
            text-align: center;
        }
    </style>
</head>
<body>
    <div id="app">
        <h1>{{count}}</h1>
        <button @click="handleClick(1)">+</button>
        <button @click="handleClick(-1)">-</button>
    </div>
    <script>
        const {createApp} = Vue
        createApp({
            data(){
                return{
                    count:0
                }
            },
            methods:{
                handleClick(step){
                    this.count += step
                }
            }
        }).mount('#app')
    </script>
</body>
</html>